<!DOCTYPE html>
<html lang="zh-cn" xml:lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"/>
    <meta name="renderer" content="webkit"/>
    <meta name="google" content="notranslate" />
    <meta name="msapplication-tap-highlight" content="no">
    <meta http-equiv="x-dns-prefetch-control" content="on">
    <link rel="dns-prefetch" href="//storagecdn.xuetangx.com">
    <link rel="dns-prefetch" href="//storage.xuetangx.com">
    <link rel="dns-prefetch" href="//cdn.mathjax.org">
    <link rel="shortcut icon" href="" type="image/x-icon">
    <link rel="icon" href="" type="image/x-icon">
    <!--
    search.xml:
    <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
                       xmlns:moz="http://www.mozilla.org/2006/browser/search/">
	  <ShortName>学堂搜索</ShortName>
	  <Description>搜索在线课程</Description>
	  <InputEncoding>UTF-8</InputEncoding>
	  <Image width="16" height="16" type="image/x-icon">https://storagecdn.xuetangx.com/public_assets/xuetangx/xuetangxXImg/logo.ico</Image>
	  <Url type="text/html" method="get" template="https://next.xuetangx.com/search?query={searchTerms}"/>
	  <moz:SearchForm>https://next.xuetangx.com/search</moz:SearchForm>
	</OpenSearchDescription>
    
	<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="学堂搜索">-->
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-transform ">
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta http-equiv="Expires" content="0">
    <meta name="keywords" content="学堂在线,学堂云,学分课,学分链">
    <meta name="description" content="学堂在线,学堂云,学分课,学分链">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>demo</title>
    <meta content="" name="keywords">
</head>
<body style="padding:0;margin:0;background: #f4f6f7;">
<div class="simple-audio" audio-url="https://static-cdn.xuetangx.com/xtassets/audioes/test-audio.mp3" style="position:relative;width:100%;padding:15px;"></div>
<div class="simple-audio" audio-url="https://static-cdn.xuetangx.com/xtassets/audioes/test-audio.mp3" style="position:relative;width:100%;padding:15px;"></div>
<div class="simple-audio" audio-url="https://static-cdn.xuetangx.com/xtassets/audioes/test-audio.mp3" style="position:relative;width:100%;padding:15px;"></div>
<div class="simple-audio" audio-url="https://static-cdn.xuetangx.com/xtassets/audioes/test-audio.mp3" style="position:relative;width:100%;padding:15px;"></div>
<div class="simple-audio" audio-url="https://static-cdn.xuetangx.com/xtassets/audioes/test-audio.mp3" style="position:relative;width:100%;padding:15px;"></div>
<div class="simple-audio" audio-url="https://static-cdn.xuetangx.com/xtassets/audioes/test-audio.mp3" style="position:relative;width:100%;padding:15px;"></div>
<script type="text/javascript" src="//storagecdn.xuetangx.com/public_assets/xuetangx/js/jquery.min.js"></script>
<!--[if IE 8]>
    <script src="http://api.html5media.info/1.1.4/html5media.min.js"></script>
    <![endif]-->
<script type="text/javascript" src="AudioPlayer.js"></script>
<script>
var audioList = [];
if(audioList.length){
    for(var i=0; i<audioList.length; i++){
      var _player = audioList[i];
      if(_player && 'pause' in _player) _player.pause();
    }
}

var audioBoxs = $(".simple-audio");
if(audioBoxs.length > 0){
    audioBoxs.each(function(e){//初始化音频
        var _that = this;
        if($(_that).attr("audio-url")){
            var audioUrl = $(_that).attr("audio-url");
            $(_that).removeAttr("audio-url");
            var _player = new AudioPlayer($(_that), {
                type: 'vocie',
                url: audioUrl,
                autoplay: false,
                startTime: 0
            });
            _player.on('play', function(e, obj){
                console.log(obj);
                if(audioList.length){
                    for(var i=0; i<audioList.length; i++){
                      var _p = audioList[i];
                      if(_p && 'pause' in _p && _p != obj) _p.pause();
                    }
                }
            }.bind(this));
            audioList.push(_player);
        }
    });
}

$("#destory-play").on("click", function(){
  player.pause();
  if(audioList.length){
      for(var i=0; i<audioList.length; i++){
        var _p = audioList[i];
        if(_p && 'pause' in _p && _p != obj) _p.pause();
      }
  }
});
</script>
</body>
</html>